//格式化时间
//dateTime：时间戳
function getFormtTime(dateTime,flag) {
    if(dateTime != null ) {
        //若传入的dateTime为字符串类型，需要进行转换成数值，若不是无需下面注释代码
        var time = parseInt(dateTime)
        var date = new Date(time);
        //获取年份
        var YY = date.getFullYear();
        //获取月份
        var MM = (date.getMonth() + 1 < 10 ? '0'+(date.getMonth() + 1) : date.getMonth() + 1);
        //获取日期
        var DD = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate());
        if(flag) { //flag为true，显示时分秒格式
            //获取小时
            var hh = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours());
            //获取分
            var mm = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes());
            ///获取秒
            var ss = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
            //返回时间格式： 2020-11-09 13:14:52
            return YY + '-' + MM + '-' + DD + ' ' + hh + ':' + mm + ':' + ss;
        } else {
            //返回时间格式： 2020-11-09
            return YY + '-' + MM + '-' + DD;
        }
    } else {
        return "";
    }
}
$.ajax({
    type: "post",
    url: "/market/customView",
    data: {},
    dataType: "json",
    success: function (r) {
        if (r!="false"){
            u="<li>\n" +
                "      <label>姓名</label>\n" +
                "      <cite>"+r.customname+"</cite>\n" +
                "    </li>\n" +
                "    <li>\n" +
                "      <label>性别</label>\n" +
                "      <cite>"+r.sex+"</cite>\n" +
                "    </li>\n" +
                "    <li>\n" +
                "      <label>所属公司名称</label>\n" +
                "      <cite>"+r.company+"</cite>\n" +
                "    </li>\n" +
                "    <li>\n" +
                "      <label>联系方式</label>\n" +
                "      <cite>"+r.telephone+"</cite>\n" +
                "    </li>\n" +
                "    <li>\n" +
                "      <label>联系地址</label>\n" +
                "      <cite>"+r.homeaddress+"</cite>\n" +
                "    </li>\n" +
                "    <li>\n" +
                "      <label>所属区域</label>\n" +
                "      <cite>"+r.provin.p_name+"</cite>\n" +
                "    </li>\n" +
                "    <li>\n" +
                "      <label>描述</label>\n" +
                "      <cite>"+r.distract+"</cite>\n" +
                "    </li>\n" +
                "    <li>\n" +
                "      <label>状态</label>\n" +
                "      <cite>"+r.status+"</cite>\n" +
                "    </li>\n" +
                "    <li>\n" +
                "      <label>创建人</label>\n" +
                "      <cite>"+r.users1.uname+"</cite>\n" +
                "    </li>\n" +
                "    <li>\n" +
                "      <label>创建时间</label>\n" +
                "      <cite>"+getFormtTime(r.createtime,true)+"</cite>\n" +
                "    </li>\n" +
                "    <li>\n" +
                "      <label>&nbsp;</label>\n" +
                "      <input name=\"\" type=\"button\" class=\"btn\" value=\"返回\" onclick=\"window.history.go(-1);\"/>\n" +
                "    </li>"
            $(".forminfo").html(u)
        }else{
            alert("查询失败！没有这个人！")
        }
    }
})